<%--
 *  File:    FileContentRuleSummary.jsp
 *  @Author: TerryCui
 *  Date:    2010/7/29
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  	//init param
  	Category cat = Category.getInstance("jsp.FileContentRuleSummary");  
  	String privilegeCode = "E0512";
    String strModuleName = "CM";
    String contextPath = request.getContextPath();
%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>FileContentRuleSummary</title>
<PageFlow:CheckPageFlow pageName="p_filecontentrulesumamry"/>
<%@ include file="/inc/CatchError.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<%
  Vector allRules = (Vector)pageContext.getAttribute("allrules");
  if(allRules == null)
	  allRules = new Vector();
%>
<script>
parent.down.location.href = "<%=contextPath%>/Blank.jsp?<%= OvalTools.randomURL() %>";

function clickRule(id){
  document.filecontentruleform.filecontentruleid.value = id;
}

function page_edit(){
  var id = document.filecontentruleform.filecontentruleid.value;
  if(id == null || id.length == 0 || id == "" || id == "-1")
    return;
  parent.down.location.href = "FileContentRuleMain.jsp?<%= OvalTools.randomURL() %>&filecontentruleid=" + id;
}

function page_info(id){
  if(id == null || id.length == 0 || id == "" || id == "-1")
    return;
  parent.down.location.href = "FileContentRuleDetail.jsp?<%= OvalTools.randomURL() %>&filecontentruleid=" + id;
}

function page_delete(){
	if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>"))
		return;
	
	filecontentruleform.actionname.value = "deleterule";
	filecontentruleform.target = "_self";
	isRunning = true;
	filecontentruleform.submit();
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <form name="filecontentruleform" method="post" action="<%=contextPath%>/Dispatcher">
      <input type="hidden" name="pagename" value="p_filecontentrulesumamry">
      <input type="hidden" name="actionname">
      <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" colspan="2" ></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td> 
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">

        <tr class="deepblue-left"> 
          <td width="5%" class="deepblue-left">&nbsp;</td>
          <td width="15%"  class="title_center"><%= label.getLabelName("L_ContentRuleCode") %></a></td>
          <td class="title_center" ><%= label.getLabelName("L_ContentRuleName") %></a></td>
          <td class="title_center" width="20%" ><%= label.getLabelName("L_TransType") %></a></td>
          <td class="title_center" width="15%" ><%= label.getLabelName("L_TableName") %></a></td>
        </tr>
        
          <%
             int i = 0;
             String strClassType = new String();   
             String strIsChecked = "Checked";
             Integer filecontentruleid = new Integer(-1);
          %>
          <logic:iterate id="rules" collection="<%= allRules %>">                      
          <%
            HashMap ruleMap = (HashMap)pageContext.getAttribute("rules"); 
            if(i%2 == 1)
              strClassType = "td-listrom";
            else                    
              strClassType = "none";
              
            if(i != 0)
            {          
              strIsChecked = "";
            }  
            else
            {
              strIsChecked = "Checked";
              filecontentruleid = (Integer)(ruleMap.get("filecontentruleid"));
            } 
            i++;     
           %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="javascript:radiotrue('rule<%=JspHelper.filterNull( i )%>');clickRule('<%=JspHelper.filterNull( ruleMap.get("filecontentruleid") )%>');" class="<%=JspHelper.filterNull( strClassType )%>"> 
            <td height="22">
              <input type="radio" id="rule<%=JspHelper.filterNull( i )%>" name="checkrule" value=<%=JspHelper.filterNull( ruleMap.get("filecontentruleid") )%> class="normalradio" <%=JspHelper.filterNull( strIsChecked)%>>
            </td>
            <td>&nbsp;<a onclick="page_info(<%=JspHelper.filterNull( ruleMap.get("filecontentruleid") )%>)"><%=JspHelper.filterNull( ruleMap.get("filecontentrulecode") )%></a></td>
            <td>&nbsp;<%=JspHelper.filterNull( ruleMap.get("filecontentrulename") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ruleMap.get("processtypename") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ruleMap.get("tablename") )%></td>
          </tr>
          </logic:iterate>
          <input type="hidden" name="filecontentruleid" value="<%=JspHelper.filterNull( filecontentruleid )%>">  
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top" ></td>
        </tr>
        <tr> 
          <td class="td_center">
          <a onclick="parent.down.location.href='FileContentRuleMain.jsp?<%= OvalTools.randomURL()%>';"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
          <a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60" privilegeCode="Btn_10311"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
</html>